Skip to content

ci: add .pot freshness and .mo compilation checks#893

Open
Krupakar-Reddy-S wants to merge 2 commits intoSeedSigner:devfrom
Krupakar-Reddy-S:ci/mo-compilation-check
Open

ci: add .pot freshness and .mo compilation checks#893
Krupakar-Reddy-S wants to merge 2 commits intoSeedSigner:devfrom
Krupakar-Reddy-S:ci/mo-compilation-check

Conversation

@Krupakar-Reddy-S
Copy link
Copy Markdown

@Krupakar-Reddy-S Krupakar-Reddy-S commented Apr 3, 2026

Description

Problem or Issue being addressed

Two localization CI gaps called out as explicit TODOs in l10n/README.md:

  1. Line 272: "Github Action to auto-generate messages.pot and fail a PR update if out of date" — a contributor can add or change translatable strings (_(), _mft(), ButtonOption()) and forget to regenerate messages.pot. Translators on Transifex never see the new strings until someone notices manually.

  2. Line 304: *"Github Actions automation to regenerate/verify that *.mo files have been updated after .po changes" — currently there is no CI check that catches stale or broken .mo files in the translations submodule.

Solution

Adds two new CI jobs to tests.yml:

pot-freshness — Copies the existing messages.pot, re-runs python setup.py extract_messages, strips the POT-Creation-Date timestamp from both files (Babel always writes the current time, which would cause a false diff), and diffs the two. Fails with a clear ::error:: message if the content changed.

mo-compilation — Runs python setup.py compile_catalog to recompile all .mo files from their .po sources, then diffs inside the translations submodule. Emits a ::warning:: annotation if any .mo file changed. Currently warns but does not fail, since ca and nl have stale .mo files at the pinned submodule commit. A TODO comment marks where to flip to exit 1 once the submodule is fixed.

Both jobs run independently of the test matrix and only need Babel, so they are lightweight and fast.

Also creates CONTRIBUTING.md with a localization section explaining when and how to run extract_messages locally. No existing contributing guide was found in the repo.

Note: the translations submodule is moving toward not committing .mo files at all (commit 76c6f57 removed them, .gitignore excludes *.mo). Once the main repo bumps its submodule pointer past that commit, the mo-compilation check becomes a "does compile_catalog succeed" validation — still useful for catching malformed .po files.

Additional Information

Verified locally three ways:

  • python setup.py extract_messages + timestamp-stripped diff: no false positives
  • Docker (docker compose run): both checks pass/warn as expected
  • act: jobs succeed end-to-end

Screenshots

N/A — CI workflow changes, no UI modifications.


This pull request is categorized as a:

  • New feature
  • Bug fix
  • Code refactor
  • Documentation
  • Other

Checklist

I ran pytest locally

  • All tests passed before submitting the PR
  • I couldn't run the tests
  • N/A

I included screenshots of any new or modified screens

Should be part of the PR description above.

  • Yes
  • No
  • N/A

I added or updated tests

Any new or altered functionality should be covered in a unit test. Any new or updated sequences require FlowTests.

  • Yes
  • No, I'm a fool
  • N/A

I tested this PR hands-on on the following platform(s):


I have reviewed these notes:

  • Keep your changes limited in scope.
  • If you uncover other issues or improvements along the way, ideally submit those as a separate PR.
  • The more complicated the PR, the harder it is to review, test, and merge.
  • We appreciate your efforts, but we're a small team of volunteers so PR review can be a very slow process.
  • Please only "@" mention a contributor if their input is truly needed to enable further progress.
  • I understand

Thank you! Please join our Devs' Telegram group to get more involved.

@Krupakar-Reddy-S Krupakar-Reddy-S changed the title ci: add .mo compilation check ci: add .pot freshness and .mo compilation checks Apr 3, 2026
@Krupakar-Reddy-S Krupakar-Reddy-S mentioned this pull request Apr 3, 2026
18 tasks
@wolgwang1729
Copy link
Copy Markdown

LGTM. I pulled this branch locally and validated the pot-freshness behavior by changing a translatable UI string without regenerating messages.pot. The check correctly ignored POT-Creation-Date noise, detected the real diff, and failed with a clear, actionable error. Great CI improvement.

Minor cross-platform note (non-blocking): the current sed -i line is fine for Ubuntu CI, but macOS/BSD sed requires an explicit backup suffix (for example, sed -i '' ). If contributors copy-paste the command locally on macOS, it may fail unless adjusted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants